/**
 * 实现Runnable接口新建线程
 */
public class ThreadDemo4 {
    public static  void main(String[] args) {
        //创建Runnable
        MyThread2 myThread2=new MyThread2();
        //创建一个线程
        Thread thread=new Thread(myThread2);
        //启动线程
        thread.start();
    }
}
class MyThread2 implements Runnable{
    @Override
    public void run(){
        //具体业务代码
        Thread thread=Thread.currentThread();//得到当前线程
        System.out.println("线程执行:"+thread.getName());
    }
}
